<template>
  <div>
     <!-- 面包屑导航 -->
   <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">
        <i class="el-icon-s-home"></i>
        首页
      </el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/member/vlist' }">
        <i class="el-icon-s-custom"></i> 
        会员管理
      </el-breadcrumb-item>
      <!-- 当前 -->
      <el-breadcrumb-item>会员等级</el-breadcrumb-item>
    </el-breadcrumb>

    <Vipsearch  @search="onsearch" />

    <div >
      <el-button type="primary"  style="margin: 0px 0 20px;" size="small" @click="addvip">添加会员等级</el-button>
      <el-table
    :data="vipslist"
    height="500"
    border
    style="width: 100%">
    <el-table-column
      prop="dengji"
      label="等级"
      width="140">
    </el-table-column>
    <el-table-column
      prop="dengjiname"
      label="等级名称"
      width="180">
    </el-table-column>
    <el-table-column
      prop="zhekou"
      label="折扣">
    </el-table-column>
    <el-table-column
      label="升级条件">
      <template slot-scope="scope">
        <p>{{ Number(scope.row.sji)?(`完成订单金额满${Number(scope.row.sji).toFixed(2)}元`):scope.row.sji}}</p>
      </template>
    </el-table-column>
    <el-table-column
      label="状态">
      <template slot-scope="scope">
        <p>{{ scope.row.statu?(scope.row.statu=='1'?'启用':'禁用'):"" }}</p>
      </template>
    </el-table-column>
    <el-table-column
      label="操作"
      >
      <template slot-scope="scope">
        <div v-show="scope.row.statu">
        <el-button @click="handleClick(scope.row)" type="text" size="small">查看详情</el-button>
        <el-button @click="handleClick1(scope.row)" type="text" size="small">修改</el-button>
        </div>
       
      </template>
    </el-table-column>
  </el-table>
    </div>
  </div>
</template>
<script>
import Vipsearch from './component/Vipsearch.vue'
import {getmsjvipdengji} from '../../utils/api'
export default{
  components: { Vipsearch },
  data(){
    return {
      vipslist:[]
    }
  },
  created(){
    getmsjvipdengji().then(res=>{
     if(res.status==200){
      res.data.data.unshift({dengji:'-----',dengjiname:'普通等级',zhekou:"",sji:"默认等级"})
     this.vipslist=res.data.data
     }
    })
  },
  methods:{
    onsearch(){
      
    },
    // 跳转详情
    handleClick(v){
      this.$router.push({
        name:'setlevel',
        params:{
          vips:v,
          breadcrumb:'添加等级',
          isshow:0
        }
      })
    },
    // 跳转修改
    handleClick1(v){
      this.$router.push({
        name:'setlevel',
        params:{
          vips:v,
          breadcrumb:'修改信息',
          isshow:1,
          isadd:0
        }
      })
    },
    // 跳转添加 
    addvip(){
      this.$router.push({
        name:'setlevel',
        params:{
          breadcrumb:'添加等级',
          isshow:1,
          isadd:1
        }
      })
    }
  }
}
</script>
<style scoped>

</style>